package util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class ApplyUtil {
    private static ApplyUtil manager;
    public static ApplyUtil getInstance() {
        if (manager == null) {
            manager = new ApplyUtil();
        }
        return manager;
    }

    public String now(){
        return LocalDateTime.now().toString().replace("T"," ");
    }

    public static Map<String,String> toMap(String jsonString) {
        Map<String,String> result = new HashMap<>();
        JSONObject map = (JSONObject) JSON.parse(jsonString);
        map.forEach((k, v)->{ result.put(k, (String) v); });
        return result;
    }
}
